USE [influenza]
GO

/****** Object:  StoredProcedure [dbo].[SP_RecMuestraLab]    Script Date: 04/07/2010 06:00:11 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER PROCEDURE [dbo].[SP_RecMuestraLab]
@param varchar(10)/*recibe el valor del id_generales*/
as
Begin
declare @qry VARCHAR(8000),
@id_laboratorio varchar(20)

Select @id_laboratorio=id_dat_laboratorio from aux_muestras Where id_muestras=@param

SET @qry='select a.id_principal as id_dat_laboratorio, a.nRechazo,
CONVERT(varchar(10),a.fRecepcion,103) as fRecepcion,
a.id_registro,CONVERT(varchar(10),a.fMuestra,103) as fMuestra,a.nEstudio,
a.nFolio_lab,CONVERT(varchar(10),a.fCalpi,103) as fCalpi,a.id_laboratorio as nUnidad
from dat_laboratorio a
Where a.id_principal='+@id_laboratorio

exec (@qry)
End
GO

